Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core][experimental] Raise an exception if a DAG is compiled twice #47431

Merged

Conversation

kevin85421
Copy link
Member

@kevin85421 kevin85421 commented Aug 30, 2024

Why are these changes needed?

If a DAG calls experimental_compile twice, the first compiled node may become a leaf node. For example,

a = DAGActor.remote()
with InputNode() as inp:
    dag = a.echo.bind(inp)
...
compiled_dag_1 = dag.experimental_compile()
# driver -> a.echo -> compiled_dag_1 (output)
...
compiled_dag.teardown()
...
compiled_dag_2 = dag.experimental_compile(enable_asyncio=True)
# driver -> a.echo -> compiled_dag_1
#                  |
#                  |-> compiled_dag_2 (output)

This PR raises an exception if a DAG is compiled twice.

Related issue number

Closes #47408

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
@kevin85421 kevin85421 marked this pull request as ready for review August 30, 2024 17:41
@ruisearch42
Copy link
Contributor

Can you elaborate a bit on the original issue (why calling compile twice is a problem)? Checked #47398 but seems no further details.
We can chat offline as well.

Copy link
Contributor

@rkooo567 rkooo567 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. nit comments on err msg update

python/ray/dag/dag_node.py Outdated Show resolved Hide resolved
python/ray/dag/dag_node.py Show resolved Hide resolved
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
Copy link
Contributor

@ruisearch42 ruisearch42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevin85421 kevin85421 added the go add ONLY when ready to merge, run all tests label Aug 30, 2024
@rkooo567
Copy link
Contributor

premerge failures

@kevin85421
Copy link
Member Author

weird, I think the RLlib CI failure is unrelated to this PR. Let me rebase with the master branch.

@rkooo567 rkooo567 enabled auto-merge (squash) August 31, 2024 06:37
@rkooo567 rkooo567 merged commit 9a744a6 into ray-project:master Sep 2, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core][experimental] Raise an exception if a DAG is compiled twice
3 participants